Created
March 8, 2016 02:03
-
-
Save Dyrr/0b4240298dfa4194639e to your computer and use it in GitHub Desktop.
Veloce esempio di array_map() per fixare il problema del magic_quotes_gpc() disabilitato
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function filter_in($str) | |
{ | |
return addslashes(str_replace('\\','',$str)); | |
} | |
//ho creto apposta un array $_GET fasullo per mostrare come funziona la funziona array_map(); | |
$_GET = array( | |
'test1' => "nell'anima", | |
'test2' => 'Pippo "Super" User' | |
); | |
$_GET = array_map('filter_in',$_GET); | |
print_r($_GET); | |
?> | |
/** output | |
Array | |
( | |
[test1] => nell\'anima | |
[test2] => Pippo \"Super\" User | |
) | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
L'esempio come gia detto altrove vuole essere un suggerimento per un fix TEMPORANEO al problema in attesa che chi si trovi in quelle condizioni sistemi il codice nel metodo corretto ovvero usando funzioni apposite per l'escape dei caratteri per l'inserimento nel database come mysql_real_escape_string(), o mysqli_real_escape_string() nelle singole query